﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace ZetaPrints.ZetaClient.Shared.Manipulator
{
    /// <summary>
    /// Xml manip[ulation has all special methods for 
    /// handling xml
    /// </summary>
    public static class XmlManipulator
    {
        /// <summary>
        /// If the attributes on this level of the XML has 
        /// at least one value it will return true.
        /// </summary>
        /// <param name="xElement"></param>
        /// <returns></returns>
        public static bool AttributeHasValue(XElement xElement)
        {
            bool attributeHasValue = false;

            foreach (XAttribute xAttribute in xElement.Attributes())
            {
                if (xAttribute.Value.Length > 0)
                {
                    attributeHasValue = true;
                    break;
                }
            }

            return attributeHasValue;
        }
    }
}
